<?php

/**
 * Reservacion filter form base class.
 *
 * @package    blackDrums
 * @subpackage filter
 * @author     Your name here
 */
abstract class BaseReservacionFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'fecha'            => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'horaInicio'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'horaFin'          => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'status'           => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'idSala'           => new sfWidgetFormPropelChoice(array('model' => 'Sala', 'add_empty' => true)),
      'idClienteNatural' => new sfWidgetFormPropelChoice(array('model' => 'ClienteNatural', 'add_empty' => true)),
      'idBanda'          => new sfWidgetFormPropelChoice(array('model' => 'Banda', 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'fecha'            => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'horaInicio'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'horaFin'          => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'status'           => new sfValidatorPass(array('required' => false)),
      'idSala'           => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Sala', 'column' => 'idSala')),
      'idClienteNatural' => new sfValidatorPropelChoice(array('required' => false, 'model' => 'ClienteNatural', 'column' => 'cedula')),
      'idBanda'          => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Banda', 'column' => 'idBanda')),
    ));

    $this->widgetSchema->setNameFormat('reservacion_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Reservacion';
  }

  public function getFields()
  {
    return array(
      'idReservacion'    => 'Number',
      'fecha'            => 'Date',
      'horaInicio'       => 'Date',
      'horaFin'          => 'Date',
      'status'           => 'Text',
      'idSala'           => 'ForeignKey',
      'idClienteNatural' => 'ForeignKey',
      'idBanda'          => 'ForeignKey',
    );
  }
}
